package com.yuyou.tas.gateway.handler;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Status;
import org.springframework.stereotype.Component;

import com.netflix.appinfo.HealthCheckHandler;
import com.netflix.appinfo.InstanceInfo.InstanceStatus;
 
@Component
public class EurekaHealthCheckHandler implements HealthCheckHandler {
 	
		@Autowired
		private ActuatorHealthHandler actuatorHealthHandler;
		
	@Override
	public InstanceStatus getStatus(InstanceStatus instanceStatus) {
		Status status = actuatorHealthHandler.health().getStatus();
		if(status.equals(Status.UP)){
			return InstanceStatus.UP;
		}else{
			return InstanceStatus.DOWN;

		}

	}
	
 
}